home *** CD-ROM | disk | FTP | other *** search
/ Aminet 31 / Aminet 31 (1999)(Schatztruhe)[!][Jun 1999].iso / Aminet / dev / gui / gtlayout.lha / Source / LTP_DrawTapeButton.c < prev    next >
C/C++ Source or Header  |  1998-09-09  |  2KB  |  116 lines

  1. /*
  2. **    GadTools layout toolkit
  3. **
  4. **    Copyright © 1993-1998 by Olaf `Olsen' Barthel
  5. **        Freely distributable.
  6. **
  7. **    :ts=4
  8. */
  9.  
  10. #ifndef _GTLAYOUT_GLOBAL_H
  11. #include "gtlayout_global.h"
  12. #endif
  13.  
  14. #include "Assert.h"
  15.  
  16. #ifdef DO_TAPEDECK_KIND    /* Support code */
  17.  
  18. VOID
  19. LTP_DrawTapeButton(struct RastPort *RPort,ImageInfo *imageInfo,LONG Left,LONG Top,LONG Width,LONG Height,LONG AspectX,LONG AspectY,LONG Background)
  20. {
  21.     LONG    SizeX,SizeY,Mid,Size;
  22.     LONG    ImageType;
  23.  
  24.     ImageType    = imageInfo -> ImageType;
  25.     SizeX        = imageInfo -> GlyphWidth;
  26.     SizeY        = imageInfo -> GlyphHeight;
  27.  
  28.     Left    += 6;
  29.     Top        += 3;
  30.  
  31.     Width    -= 2 * 6;
  32.     Height    -= 2 * 3;
  33.  
  34.     if(!SizeY)
  35.         SizeY = Height;
  36.  
  37.     if(!SizeX)
  38.     {
  39.         SizeX = (SizeY * AspectY) / AspectX;
  40.  
  41.         if(ImageType == IMAGECLASS_BACKWARD || ImageType == IMAGECLASS_FORWARD)
  42.             SizeX *= 2;
  43.     }
  44.  
  45.     if(SizeX > 0 && SizeY > 0)
  46.     {
  47.         switch(ImageType)
  48.         {
  49.             case IMAGECLASS_BACKWARD:
  50.             case IMAGECLASS_FORWARD:
  51.  
  52.                 Left    = Left + (Width - SizeX) / 2;
  53.                 Top        = Top + (Height - SizeY) / 2;
  54.  
  55.                 LTP_DrawBackFore(RPort,ImageType == IMAGECLASS_BACKWARD,Left,Top,SizeX,SizeY);
  56.                 break;
  57.  
  58.             case IMAGECLASS_PREVIOUS:
  59.             case IMAGECLASS_NEXT:
  60.  
  61.                 Left    = Left + (Width - SizeX) / 2;
  62.                 Top        = Top + (Height - SizeY) / 2;
  63.  
  64.                 LTP_DrawPrevNext(RPort,ImageType == IMAGECLASS_PREVIOUS,Left,Top,SizeX,SizeY);
  65.                 break;
  66.  
  67.             case IMAGECLASS_EJECT:
  68.  
  69.                 Left    = Left + (Width - SizeX) / 2;
  70.                 Top        = Top + (Height - SizeY) / 2;
  71.  
  72.                 LTP_DrawPicker(RPort,TRUE,Left,Top,SizeX,SizeY);
  73.                 break;
  74.  
  75.             case IMAGECLASS_RECORD:
  76.  
  77.                 LTP_RenderCircle(RPort,Left + Width / 2,Top + Height / 2,SizeY / 2,AspectX,AspectY);
  78.                 break;
  79.  
  80.             case IMAGECLASS_PLAY:
  81.             case IMAGECLASS_REWIND:
  82.  
  83.                 Left    = Left + (Width - SizeX) / 2;
  84.                 Top        = Top + (Height - SizeY) / 2;
  85.  
  86.                 LTP_RenderArrow(RPort,ImageType == IMAGECLASS_REWIND,Left,Top,SizeX,SizeY);
  87.                 break;
  88.  
  89.             case IMAGECLASS_STOP:
  90.  
  91.                 Left    = Left + (Width - SizeX) / 2;
  92.                 Top        = Top + (Height - SizeY) / 2;
  93.  
  94.                 LTP_FillBox(RPort,Left,Top,SizeX,SizeY);
  95.                 break;
  96.  
  97.             case IMAGECLASS_PAUSE:
  98.  
  99.                 Left    = Left + (Width - SizeX) / 2;
  100.                 Top        = Top + (Height - SizeY) / 2;
  101.  
  102.                 LTP_FillBox(RPort,Left,Top,SizeX,SizeY);
  103.  
  104.                 Size    = SizeX - (2 * SizeX) / 3;
  105.                 Mid        = SizeX / 3;
  106.  
  107.                 LTP_SetAPen(RPort,Background);
  108.                 LTP_FillBox(RPort,Left + Mid,Top,Size,SizeY);
  109.  
  110.                 break;
  111.         }
  112.     }
  113. }
  114.  
  115. #endif    /* DO_TAPEDECK_KIND */
  116.